package test;

public class test2 {
    public static void main(String[] args) {
        /*
        * 匿名实现
        * */
        Thread t1=new Thread(new Runnable() {
            @Override
            public void run() {
                String name = Thread.currentThread().getName();
                for (int i = 0; i < 5; i++) {
                    System.out.println(name + "正在执行第" + (i + 1) + "次");
                }
            }
        },"A");

        Thread t2=new Thread(new Runnable() {
            @Override
            public void run() {
                String name = Thread.currentThread().getName();
                for (int i = 0; i < 5; i++) {
                    System.out.println(name + "正在执行第" + (i + 1) + "次");
                }
            }
        },"B");
    }
}
